package com.topnav.mc.admin.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.topnav.mc.admin.entity.Fence;
import com.topnav.mc.admin.entity.bean.FenceBean;
import com.topnav.mc.admin.entity.param.FenceParam;
import com.topnav.mc.admin.entity.param.RoleParam;
import com.topnav.mc.base.mc.McMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: kenny
 * @Date: 2023/11/13 10:38
 */
@Mapper
public interface FenceMapper extends McMapper<Fence, FenceBean, FenceParam> {
    String commSql = " SELECT f.*," +
            "o.code AS orgCode, o.name AS orgName, o.short_name AS shortName, o.path " +
            " FROM mc_fence f " +
            " LEFT JOIN mc_organization o ON f.org_id = o.id " +
            " ${ew.customSqlSegment}";

    @Select(commSql)
    FenceBean selectInfoOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    List<FenceBean> selectInfoList(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    Page<FenceBean> selectInfoPage(Page<FenceParam> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);

}
